<template>
    <div class="mui-numbox" data-numbox-min='1' style="height:25px" >
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input id="test" class="mui-input-numbox" type="number" :value="num"
        @change="countChange" ref="numBox" readonly/>
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
    <!-- 子组件何时将数据传递给父组件？ -->
</template>


<script>
import mui from '../../assets/js/mui.min.js';
export default {
    data () {
        return {
            
        }
    },
   
    props: ['num',"goodId"],
    mounted () {
        // 初始化数字框
        mui(".mui-numbox").numbox();
        // this.getAllgoodInCar();
    },
    methods: {      
        countChange(){
            // 数量变了
           console.log(this.$refs.numBox.value)
           const inf={
               "id":this.goodId,
               "val":this.$refs.numBox.value
           }
           this.$store.commit("changeNumInCar",inf)
        },
    },
    computed: {
       
    }
}
</script>

<style lang="scss" scoped>

</style>

